Skip to content

Conversation

@jr
Copy link
Collaborator

@jr jr commented Jun 1, 2025

Move the persistent auth data into a single secret and listen for updates to it. Some rearranging of AuthService logic to reduce duplication.


Important

Improves AuthService by consolidating auth credentials into a single secret, enhancing state management, and adding zod for validation.

  • AuthService Logic:
    • Consolidates clientToken and sessionId into credentials object in AuthService.ts.
    • Introduces authCredentialsSchema using zod for validation.
    • Adds handleCredentialsChange(), transitionToLoggedOut(), and transitionToInactiveSession() for state management.
    • Replaces individual secret keys with AUTH_CREDENTIALS_KEY.
    • Updates clerkSignIn() to return credentials object.
  • State Management:
    • Listens for secret changes to update auth state.
    • Uses onDidChange event to handle credential updates.
  • Dependencies:
    • Adds zod to dependencies in package.json.

This description was created by Ellipsis for 9a30535. You can customize this summary. It will automatically update as commits are pushed.

@jr jr marked this pull request as ready for review June 1, 2025 07:25
@jr jr requested review from cte and mrubens as code owners June 1, 2025 07:25
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 1, 2025

this.fetchUserInfo()
await this.storeCredentials(credentials)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After storing credentials in handleCallback, consider invoking handleCredentialsChange() directly to immediately update the in-memory state rather than solely relying on onDidChange events.

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 1, 2025
@mrubens mrubens merged commit 3fc05ad into main Jun 1, 2025
11 checks passed
@mrubens mrubens deleted the jr/auth-cleanup branch June 1, 2025 14:01
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jun 1, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jun 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants